package com.csr.csrcheck.controller;

import com.csr.csrcheck.pojo.Other;
import com.csr.csrcheck.service.OtherService;
import com.csr.csrcheck.util.JsonResult;
import com.csr.csrcheck.util.PageResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping({"other"})
public class OtherConntroller extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(com.csr.csrcheck.controller.OtherConntroller.class);

    @Resource
    private OtherService otherService;

    @GetMapping({"otherlist"})
    public JsonResult<List<Other>> getlistByCompany_id() {
        List<Other> list = this.otherService.getOtherList();
        return new JsonResult(Integer.valueOf(0), "json", list);
    }

    @GetMapping({"other"})
    public JsonResult<Object> contend(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "5") int pageSize, String company_name) {
        PageResult pageResult = this.otherService.getListpage(pageNum, pageSize, company_name);
        log.info("contend---------------------------------->pageNum:" + pageNum);
        log.info("contend---------------------------------->pageSize:" + pageSize);
        log.info("contend---------------------------------->company_name:" + company_name);
        return new JsonResult(Integer.valueOf(0), "json", pageResult);
    }
}
